//
//  FMDBManager.h
//  LBBase
//
//  Created by Gary on 15/7/1.
//  Copyright (c) 2015年 Lebo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseModel.h"

@class FMDatabase;
@interface FMDBManager : NSObject
+ (FMDBManager *)sharedInstance;
+ (FMDatabase *)openDatabase;
+ (void)recreateTables;

// 添加数据
- (BOOL)insert:(BaseModel*)model;
- (BOOL)insert:(NSArray*)models isTransaction:(BOOL)flag;

// 删除数据
- (BOOL)deleteT:(BaseModel*)model;

- (NSString*)makeInsertSql:(BaseModel*)model properties:(NSDictionary*)properties;

- (NSArray*)executeQuery:(NSString*)sql class:(Class)class;
- (BOOL)executeUpdate:(NSString*)sql, ...;
- (BOOL)executeUpdate:(NSString*)sql values:(NSArray*)array;
- (BOOL)executeUpdate:(NSArray*)sqls values:(NSArray*)values isTransaction:(BOOL)flag;

@end
